package com.wz.project.sap.POST_TMDATA_SERIALAREA.controller;

import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.wz.framework.aspectj.lang.annotation.Log;
import com.wz.framework.aspectj.lang.enums.BusinessType;
import com.wz.project.sap.POST_TMDATA_SERIALAREA.domain.YppRfcPostTmdataSerialarea;
import com.wz.project.sap.POST_TMDATA_SERIALAREA.service.IYppRfcPostTmdataSerialareaService;
import com.wz.framework.web.controller.BaseController;
import com.wz.framework.web.domain.AjaxResult;
import com.wz.common.utils.poi.ExcelUtil;
import com.wz.framework.web.page.TableDataInfo;

/**
 * 生产订单入库SERIALAREAController
 * 
 * @author wz
 * @date 2022-09-20
 */
@Controller
@RequestMapping("/POST_TMDATA_SERIALAREA/POST_TMDATA_SERIALAREA")
public class YppRfcPostTmdataSerialareaController extends BaseController
{
    private String prefix = "POST_TMDATA_SERIALAREA/POST_TMDATA_SERIALAREA";

    @Autowired
    private IYppRfcPostTmdataSerialareaService yppRfcPostTmdataSerialareaService;

//    @RequiresPermissions("POST_TMDATA_SERIALAREA:POST_TMDATA_SERIALAREA:view")
    @GetMapping()
    public String POST_TMDATA_SERIALAREA()
    {
        return prefix + "/POST_TMDATA_SERIALAREA";
    }

    /**
     * 查询生产订单入库SERIALAREA列表
     */
//    @RequiresPermissions("POST_TMDATA_SERIALAREA:POST_TMDATA_SERIALAREA:list")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(YppRfcPostTmdataSerialarea yppRfcPostTmdataSerialarea)
    {
        startPage();
        List<YppRfcPostTmdataSerialarea> list = yppRfcPostTmdataSerialareaService.selectYppRfcPostTmdataSerialareaList(yppRfcPostTmdataSerialarea);
        return getDataTable(list);
    }

    /**
     * 导出生产订单入库SERIALAREA列表
     */
//    @RequiresPermissions("POST_TMDATA_SERIALAREA:POST_TMDATA_SERIALAREA:export")
    @Log(title = "生产订单入库SERIALAREA", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ResponseBody
    public AjaxResult export(YppRfcPostTmdataSerialarea yppRfcPostTmdataSerialarea)
    {
        List<YppRfcPostTmdataSerialarea> list = yppRfcPostTmdataSerialareaService.selectYppRfcPostTmdataSerialareaList(yppRfcPostTmdataSerialarea);
        ExcelUtil<YppRfcPostTmdataSerialarea> util = new ExcelUtil<YppRfcPostTmdataSerialarea>(YppRfcPostTmdataSerialarea.class);
        return util.exportExcel(list, "POST_TMDATA_SERIALAREA");
    }

    /**
     * 新增生产订单入库SERIALAREA
     */
    @GetMapping("/add")
    public String add()
    {
        return prefix + "/add";
    }

    /**
     * 新增保存生产订单入库SERIALAREA
     */
    @RequiresPermissions("POST_TMDATA_SERIALAREA:POST_TMDATA_SERIALAREA:add")
    @Log(title = "生产订单入库SERIALAREA", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    @ResponseBody
    public AjaxResult addSave(YppRfcPostTmdataSerialarea yppRfcPostTmdataSerialarea)
    {
        return toAjax(yppRfcPostTmdataSerialareaService.insertYppRfcPostTmdataSerialarea(yppRfcPostTmdataSerialarea));
    }

    /**
     * 修改生产订单入库SERIALAREA
     */
    @GetMapping("/edit/{MANDT}")
    public String edit(@PathVariable("MANDT") String MANDT, ModelMap mmap)
    {
        YppRfcPostTmdataSerialarea yppRfcPostTmdataSerialarea = yppRfcPostTmdataSerialareaService.selectYppRfcPostTmdataSerialareaById(MANDT);
        mmap.put("yppRfcPostTmdataSerialarea", yppRfcPostTmdataSerialarea);
        return prefix + "/edit";
    }

    /**
     * 修改保存生产订单入库SERIALAREA
     */
    @RequiresPermissions("POST_TMDATA_SERIALAREA:POST_TMDATA_SERIALAREA:edit")
    @Log(title = "生产订单入库SERIALAREA", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    @ResponseBody
    public AjaxResult editSave(YppRfcPostTmdataSerialarea yppRfcPostTmdataSerialarea)
    {
        return toAjax(yppRfcPostTmdataSerialareaService.updateYppRfcPostTmdataSerialarea(yppRfcPostTmdataSerialarea));
    }

    /**
     * 删除生产订单入库SERIALAREA
     */
    @RequiresPermissions("POST_TMDATA_SERIALAREA:POST_TMDATA_SERIALAREA:remove")
    @Log(title = "生产订单入库SERIALAREA", businessType = BusinessType.DELETE)
    @PostMapping( "/remove")
    @ResponseBody
    public AjaxResult remove(String ids)
    {
        return toAjax(yppRfcPostTmdataSerialareaService.deleteYppRfcPostTmdataSerialareaByIds(ids));
    }
}
